package com.exchange.employee.entity;


import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

@Document(indexName = "ideal", type = "article", shards = 1, replicas = 0)
public class Article {

    /**
     * 主键
     */
    @Id
    private Long id; // spuId

    /**
     * 标题
     */
    @Field(type = FieldType.Keyword)
    private String title;

    /**
     * 创建时间
     */
    @Field(type = FieldType.Date, format = DateFormat.date)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date create_date;

    /**
     * 作者
     */
    @Field(type = FieldType.Keyword)
    private String author;

    /**
     * 文章内容
     */
    @Field(type = FieldType.Text, analyzer = "ik_smart")
    private String content;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Date getCreate_date() {
        return create_date;
    }

    public void setCreate_date(Date create_date) {
        this.create_date = create_date;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }
}
